package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var i int = 10
	println(i)
	var i1 = 10
	var (
		j = 0
		k = 1
	)
	println(i1, j, k)

	var f32 float32 = 2.2
	var f64 float64 = 10.3456
	fmt.Println("f32 is ", f32, ",f64 is ", f64)

	var bf, bt = false, true
	fmt.Println("bf is ", bf, ",bt is ", bt)

	var s1 string = "Hello"
	var s2 string = "世界"
	fmt.Println("s1 is ", s1, ",s2 is ", s2)
	fmt.Println("s1 + s2 = ", s1+s2)

	var zi int
	var zf float64
	var zb bool
	var zs string
	fmt.Println("zi is ", zi, ",zf is ", zf, ",zb is ", zb, ",zs is ", zs)

	i2 := 10
	bf2 := false
	s22 := "Hello"
	fmt.Println(i2, bf2, s22)

	pi := &i2
	fmt.Println("pi is ", pi)
	fmt.Println("*pi is ", *pi)

	i = 20
	fmt.Println("i new value is ", i)

	const name = "He"
	const (
		one   = 1
		two   = 2
		three = 3
	)
	fmt.Println(name, one, two, three)

	//iota
	const (
		ca = iota + 1
		cb
		cc
		cd
		_
		ce
		cf
	)
	fmt.Println(ca, cb, cc, cd, ce)
	typeChange()

	fmt.Println(strings.HasPrefix(s1, "H"))
	fmt.Println(strings.Index(s1, "o"))
	fmt.Println(strings.ToUpper(s1))
	fmt.Println(strings.ToLower(s1))
}
func typeChange() {
	i := 123
	i2s := strconv.Itoa(i)
	fmt.Println(i2s)
	num, _ := strconv.Atoi(i2s)

	fmt.Println("num is ", num)

	//fmt.Println(strconv.Atoi(i2s))
}
